#include<stdio.h>
int main()
{
	int num = 0;
	scanf_s("%d", &num);
	int count = 0;
	int my_best(int);
	my_best(num);
	return 0;
}
int my_best(int num)
{
	int i = 0;
	for (i = 31; i >= 1; i -= 2)
		printf("%d ", (num >> i) & 1);
		printf("\n");
		printf(" ");
	for (i = 30; i >=0; i -= 2)
    {
		printf("%d ", (num >> i) & 1);
    }
	return 0;
}